package com.tceasy.gateway.controller;

import com.tceasy.gateway.domain.OpenUser;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * controller基类
 * @author zhsj
 *
 */
public abstract class AbstractController {
    public final static String USER_IN_SESSION = "user_in_session";

	/**
	 * 获取session
	 * @param request
	 * @return
	 */
	protected HttpSession getSession(HttpServletRequest request){
		return request.getSession();
	}
	
	/**
	 * 获取当前登陆用户信息
	 * @param request
	 * @return
	 */
	protected OpenUser getCurrentUser(HttpServletRequest request){
		return (OpenUser) request.getSession().getAttribute(USER_IN_SESSION);
	}
	
}
